﻿/**
 * ...
 * @author Sergey Mamyan
 */

package tx.squirrel.neko.opensocial.handler;

import mtwin.web.Request;
import neko.Lib;
import neko.Web;
import tx.squirrel.neko.core.handler.BaseHandler;
import tx.squirrel.neko.core.model.Config;
import tx.squirrel.neko.core.model.Session;

class OpenSocialHandler extends BaseHandler {
	
	public function new() {
		super();
		free("default", 			"opensocial.mtt", 	doDefault);
		free("application.xml", 	"opensocial.mtt", 	doDefault);
		free("html",				"opensocial_html.mtt", 	doHtml);
	}
	
	public function doDefault():Void {
		Web.setHeader("Content-Type", "application/xml");
		Lib.println('<?xml version="1.0"?>');
		display({
			params:Web.getParams(),
			headers:Web.getClientHeaders(),
			ip:Web.getClientIP(),
			uri:Web.getURI()
		});
	}
	
	public function doHtml():Void {
		display({
			params:Web.getParams(),
			headers:Web.getClientHeaders(),
			ip:Web.getClientIP(),
			uri:Web.getURI()
		});
	}
}